/*
 * @Author: tanjunyi@doctorwork.com
 * @Date: 2020-06-21 09:40:49
 * @LastEditors: tanjunyi@doctorwork.com
 * @LastEditTime: 2020-06-22 22:33:38
 * @Description:
 */
import { createTextVNode, createElement } from "./vdom/index";

export function renderMixin(Vue) {
	// 文本内容
	Vue.prototype._v = function (text) {
		return createTextVNode(text);
	}
	// 创建元素
	Vue.prototype._c = function () {
		return createElement(...arguments);
	}
	// 函数处理
	Vue.prototype._s = function (value) {
		// 判读如果是对象，则序列化处理成字符串
		return value == null ? '' : (typeof value === 'object' ? JSON.stringify(value) : value)
	}
	Vue.prototype._render = function () {
		const vm = this;
		const { render } = vm.$options;

		const vnode = render.call(vm);
		return vnode;
	}
}